package Work1;
import java.util.Random;
import java.util.Scanner;

public class _21Point {
	public static void main(String[] args) {
		Random rd = new Random();
		Scanner sc = new Scanner(System.in);
		int userpoint;
		int pcpoint;
		int choice = 0;
		pcpoint = rd.nextInt(21)+1;
		userpoint = rd.nextInt(21)+1;
		System.out.println("你的点数为："+userpoint);
		while(choice == 0) {
			System.out.println("继续抽牌请输入0，不抽牌请输入1");
			choice = sc.nextInt();
			if(choice == 0) {
				userpoint += rd.nextInt(21)+1;
				System.out.println("你的点数："+userpoint);
				if(userpoint > 21) {
					System.out.println("你的点数："+userpoint+",点数超过21");
					System.out.println("你输了");
					return;
				}
			}else if (choice == 1) {
				break;
			}else {
				System.out.println("输入错误，请输入0或1");
				choice = sc.nextInt();
			}
		}
		if(userpoint > pcpoint) {
			System.out.println("你的点数："+userpoint+"，对手的点数："+pcpoint);
			System.out.println("你赢了");
		}else if(userpoint == pcpoint) {
			System.out.println("你的点数："+userpoint+"，对手的点数："+pcpoint);
			System.out.println("平局");
		}else if(userpoint < pcpoint) {
			System.out.println("你的点数："+userpoint+"，对手的点数："+pcpoint);
			System.out.println("你输了");
		}
	}

}
